package com.leyou.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @author xhh
 * @date 2022/3/22
 */
@Configuration
@PropertySource(value = {"classpath:properties/application.properties"})
@ConfigurationProperties(prefix = "aliyun")
@Data
public class AliyunConfig {
    private String endpoint="oss-cn-beijing.aliyuncs.com";
    private String accessKeyId="LTAI5tCaRz4qGRotPT2mQ8S9";
    private String accessKeyIdSecret="ldLOnCf2loV50NN5wgc3Rxd1zw2r71";
    private String bucketName;
    private String urlPrefix;
    @Bean
    public OSS ossClient(){
        return new OSSClient(endpoint,accessKeyId,accessKeyIdSecret);
    }

}
